#include <stdlib.h>
#include <stdio.h>

/* alignment macro: aligns a memory block to multiples of a */
#define align(s,a) (((size_t) (s) + ((a) - 1)) & ~((size_t) (a) -1))
/* Alignment for SEE unit */
#define SSE_ALIGN (16)
/* Number of elements */
#define NUM (100)

extern void mymin(int, float *, float *, float *);

int main (void) {
	float *a= malloc(sizeof(float)*NUM + SSE_ALIGN),
	*b= malloc(sizeof(float)*NUM + SSE_ALIGN),
	*c= malloc(sizeof(float)*NUM + SSE_ALIGN);

/* make sure that pointers are aligned to multiples of 16 bytes */
a = (float *) align(a, SSE_ALIGN);
b = (float *) align(b, SSE_ALIGN);
c = (float *) align(c, SSE_ALIGN);

/* write values to a and b */
*a = 0.0;
*b = 0.0;
*c = 0.0;

/* invoke the function written in the vector language */
mymin(NUM, a ,b, c);
/* read values from c */

/* for consistency */
printf("a=%f\n",*(a));
printf("b=%f\n",*(b));
printf("c=%f\n",*(c));
//printf("posc=%i\n",*(c+1));
return 0;
}
